package days48;

import java.util.Scanner;
import java.util.Stack;

public class day22 {
    public static void playCard(int[] cards, int n, int k) {
// i --> 2 * i
// i + n ---> 2 * i + 1
        for (int i = 0; i < k; ++i) {
//一次洗牌的过程
            int[] newCards = new int[cards.length];
//遍历编号为 0 ~ n - 1
            for (int j = 0; j < n; ++j) {
                newCards[2 * j] = cards[j];
                newCards[2 * j + 1] = cards[j + n];
            }
            cards = newCards;
        }
        printCard(cards);
    }
    public static void printCard(int[] cards) {
        for (int i = 0; i < cards.length - 1; ++i) {
            System.out.print(cards[i] + " ");
        }
        System.out.println(cards[cards.length - 1]);
    }
    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        int t=scanner.nextInt();
        for (int i = 0; i < t; i++) {
            int n=scanner.nextInt();
            int k=scanner.nextInt();
            int[] arr=new int[2*n];
            for (int j = 0; j < 2*n; j++) {
                arr[j]=scanner.nextInt();
            }
            playCard(arr,n,k);
        }
    }
}
